<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sends data from parameter streams to the server</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.sqlsrv-send-stream-data" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlsrv_send_stream_data</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">sqlsrv_send_stream_data</span> &mdash; <span class="dc-title">Sends data from parameter streams to the server</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.sqlsrv-send-stream-data-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>sqlsrv_send_stream_data</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stmt</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Send data from parameter streams to the server. Up to 8 KB of data is sent 
   with each call.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.sqlsrv-send-stream-data-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">stmt</code></dt>

     <dd>

      <p class="para">
       A statement resource returned by <span class="function"><a href="sqlsrv_query.html" class="function">sqlsrv_query()</a></span> or 
       <span class="function"><a href="sqlsrv_execute.html" class="function">sqlsrv_execute()</a></span>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.sqlsrv-send-stream-data-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if there is more data to send and <strong><code>FALSE</code></strong> if there is not.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.sqlsrv-send-stream-data-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2591">
    <p><strong>Example #1 <span class="function"><strong>sqlsrv_send_stream_data()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$serverName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"serverName\sqlexpress"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$connectionInfo&nbsp;</span><span style="color: #007700">=&nbsp;array(&nbsp;</span><span style="color: #DD0000">"Database"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"dbName"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"UID"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"username"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"PWD"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"password"&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlsrv_connect</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$serverName</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$connectionInfo</span><span style="color: #007700">);<br />if(&nbsp;</span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">sqlsrv_errors</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br />}<br /><br /></span><span style="color: #0000BB">$sql&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"UPDATE&nbsp;Table_1&nbsp;SET&nbsp;data&nbsp;=&nbsp;(&nbsp;?)&nbsp;WHERE&nbsp;id&nbsp;=&nbsp;100"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Open&nbsp;parameter&nbsp;data&nbsp;as&nbsp;a&nbsp;stream&nbsp;and&nbsp;put&nbsp;it&nbsp;in&nbsp;the&nbsp;$params&nbsp;array.<br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"data://text/plain,[&nbsp;Lengthy&nbsp;content&nbsp;here.&nbsp;]"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;array(&nbsp;&amp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Prepare&nbsp;the&nbsp;statement.&nbsp;Use&nbsp;the&nbsp;$options&nbsp;array&nbsp;to&nbsp;turn&nbsp;off&nbsp;the<br />//&nbsp;default&nbsp;behavior,&nbsp;which&nbsp;is&nbsp;to&nbsp;send&nbsp;all&nbsp;stream&nbsp;data&nbsp;at&nbsp;the&nbsp;time&nbsp;of&nbsp;query<br />//&nbsp;execution.<br /></span><span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"SendStreamParamsAtExec"</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlsrv_prepare</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$sql</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$params</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">sqlsrv_execute</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Send&nbsp;up&nbsp;to&nbsp;8K&nbsp;of&nbsp;parameter&nbsp;data&nbsp;to&nbsp;the&nbsp;server&nbsp;<br />//&nbsp;with&nbsp;each&nbsp;call&nbsp;to&nbsp;sqlsrv_send_stream_data.<br /></span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />while(&nbsp;</span><span style="color: #0000BB">sqlsrv_send_stream_data</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++;<br />}<br />echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$i</span><span style="color: #DD0000">&nbsp;calls&nbsp;were&nbsp;made."</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.sqlsrv-send-stream-data-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="sqlsrv_prepare.html" class="function" rel="rdfs-seeAlso">sqlsrv_prepare()</a> - Prepares a query for execution</span></li>
    <li class="member"><span class="function"><a href="sqlsrv_query.html" class="function" rel="rdfs-seeAlso">sqlsrv_query()</a> - Prepares and executes a query</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>